import { getPeopleRecord } from '../../api/long-insure'
Page({
    data: {
        records: [],
        detail: {}
    },
    static: {
        idCardNo: null,
        pageNum: 1,
        hasNext: 1
    },
    onLoad(options){
        this.static.idCardNo = options.idcard
        this.getRecord()
    },
    async getRecord(clear){
        if(clear){
            this.static.pageNum = 1
            this.static.hasNext = true
            this.data.records = []
        }
        if(!this.static.hasNext){
            return
        }
        const result = await getPeopleRecord({
            idCardNo: this.static.idCardNo,
            pageNum: this.static.pageNum,
            pageSize: 20
        })
        this.static.hasNext = result.hasNextPage
        this.static.pageNum += 1
        this.data.records.push(...result.list)
        this.setData({
            records:  this.data.records,
            detail: result.staffInfo
        })
    },
})